<?php

/**
 * Scara form base class.
 *
 * @method Scara getObject() Returns the current form's model object
 *
 * @package    acap
 * @subpackage form
 * @author     Verminu
 */
abstract class BaseScaraForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'denumire'           => new sfWidgetFormInputText(),
      'bloc_id'            => new sfWidgetFormPropelChoice(array('model' => 'Bloc', 'add_empty' => false)),
      'adresa'             => new sfWidgetFormInputText(),
      'apartamente_ramase' => new sfWidgetFormInputText(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
      'deleted_at'         => new sfWidgetFormDateTime(),
      'added_at'           => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'denumire'           => new sfValidatorString(array('max_length' => 16)),
      'bloc_id'            => new sfValidatorPropelChoice(array('model' => 'Bloc', 'column' => 'id')),
      'adresa'             => new sfValidatorString(array('max_length' => 128)),
      'apartamente_ramase' => new sfValidatorInteger(array('min' => -32768, 'max' => 32767, 'required' => false)),
      'created_at'         => new sfValidatorDateTime(array('required' => false)),
      'updated_at'         => new sfValidatorDateTime(array('required' => false)),
      'deleted_at'         => new sfValidatorDateTime(array('required' => false)),
      'added_at'           => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('scara[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Scara';
  }


}
